package com.snopy.io.bytestream;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author snopy
 * @version 1.0.0
 * @classname DemoByteStream
 * @description
 * @email 77912204@qq.com
 * @date 2022/11/15 19:12
 */
public class DemoByteStream {

    public static void main(String[] args){

        FileInputStream in = null;
        FileOutputStream out = null;
        try {
             in = new FileInputStream("F:\\workspaceA\\Sonata\\Sonata_test\\src\\main\\resources\\abc.txt");
             out = new FileOutputStream("/abc.txt");
             int b = 0;
             while ((b = in.read())!=-1){
                 out.write(b);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            if (in !=null){
                try {
                    in.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (out != null){
                try {
                    out.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
